package com.laborer.model.result;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @Auther: Wangym
 * @Date: 2021/6/7 17:44
 * @Description:
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class Result {
    private Integer code;
    private boolean success;
    private String msg;
    private Object data;
    public long count;
    public int pages;

    public void error(String message){
        this.msg=message;
        this.code=400;
        this.success=false;
    }

    public void success(Object object, int count, int pages){
        this.setCount(count);
        this.setPages(pages);
        this.setSuccess(true);
        this.setMsg("操作成功");
        this.setCode(0);
        this.setData(object);
    }


}
